<extend name="Public/base"/>
<block name="body">
    <div class="main-title">
        <h2>
            新增商品
        </h2>
    </div>
    <form action="{:U('add')}" class="form-horizontal" method="post" enctype="multipart/form-data">
        <div class="form-item">
            <label class="item-label">
                商品名称
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <input class="text input-large" name="name" type="text" value="">
                </input>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                商品描述
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <input class="text input-large" name="des" type="text" value="">
                </input>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                分类
                <span class="check-tips">
                </span>
            </label>
            <div class="controls" ">
                <select name="sort" class="drop">
                <option value="">请选择分类</option>
                    <foreach name="res" item="vo">
                    <option value='{$vo.id}'>{$vo.title}</option>
                    </foreach>
                </select>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                热销
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <label class="radio">
                    <input class="" name="hot" type="radio" value="0">
                    非热销商品
                    </input>
                </label>
                <label class="radio">
                    <input checked="" class="" name="hot" type="radio" value="1" >
                    热销商品
                    </input>
                </label>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                上架
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <label class="radio">
                    <input class="" name="up" type="radio" value="1">
                    上架中
                    </input>
                </label>
                <label class="radio">
                    <input checked="" class="" name="up" type="radio" value="0">
                    下架中
                    </input>
                </label>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">
                商品图片
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <input class="text input-large" name="pic" type="file" value="">
                </input>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">
                状态
                <span class="check-tips">
                </span>
            </label>
            <div class="controls">
                <label class="radio">
                    <input class="" name="status" type="radio" value="0">
                    隐藏
                    </input>
                </label>
                <label class="radio">
                    <input checked="" class="" name="status" type="radio" value="1">
                    显示
                    </input>
                </label>
            </div>
        </div>
        <div class="form-item">
            <button class="btn submit-btn " id="submit" target-form="form-horizontal" type="submit">
                确 定
            </button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">
                返 回
            </button>
        </div>
    </form>
</block>
<block name="script">
<script>
    
   $(".controls").on('change','.drop',function(){
        // alert(111);
        var t=$(this);
        var id=t.val();
        var url="{:U('ajax')}";
        $.get(url,{fid:id},function(data){
            if(data.status ==1){
            t.nextAll().remove();
            t.after(data.res);
            }
        });
    })
</script>
<script type="text/javascript">//导航高亮
highlight_subnav('{:U('User / index')}');
</script>
</block>



